#导入selenium2中的webdriver库
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# code is far away from bugs with the god animal protecting
    I love animals. They taste delicious.
              ┏┓      ┏┓
            ┏┛┻━━━┛┻┓
            ┃      ☃      ┃
            ┃  ┳┛  ┗┳  ┃
            ┃      ┻      ┃
            ┗━┓      ┏━┛
                ┃      ┗━━━┓
                ┃  大牛保佑    ┣┓
                ┃　永无BUG！   ┏┛
                ┗┓┓┏━┳┓┏┛
                  ┃┫┫  ┃┫┫
                  ┗┻┛  ┗┻┛
"""
from selenium import webdriver
import time
import http.cookiejar
driver = webdriver.Chrome(executable_path="D:\chromedriver\chromedriver.exe")
driver.maximize_window()
#登录QQ空间
def get_shuoshuo(qq):
    driver.get('http://user.qzone.qq.com/{}/311'.format(qq))
    time.sleep(5)
    try:
        driver.find_element_by_id('login_div')
        a = True
    except:
        a = False
    if a == True:
        driver.switch_to.frame('login_frame')
        driver.find_element_by_id('switcher_plogin').click()
        driver.find_element_by_id('u').clear()#选择用户名框
        driver.find_element_by_id('u').send_keys('1421479985')
        driver.find_element_by_id('p').clear()
        driver.find_element_by_id('p').send_keys('0101201a')
        driver.find_element_by_id('login_button').click()
        time.sleep(3)
        for i in range(100):
           driver.execute_script("window.scrollBy(0,500);")
        time.sleep(2)

#driver.find_element_by_id('pager_num_8_5').click()

print(cookie)
if __name__ == '__main__':
    get_shuoshuo('846451473')